<?php
namespace app\api\validate;

use think\Validate;

class Member extends Validate
{
    /**
     * @var string[]
     */
    protected $rule =   [
        'user'  => 'require|length:4,25',
        'password'   => 'alphaNum|length:4,25',
        'passworda'   => 'alphaNum|length:4,25|confirm:password',
        'captcha' => 'require|captcha',

        'newpassword' => 'alphaNum|length:4,25',


    ];
    /**
     * 如果没有定义错误提示信息，则使用系统默认的提示信息
     */
    protected $message  =   [


    ];
    //登录
    public function sceneLogin()
    {
        return $this->only(['user','password']);
    }

    //注册
    public function sceneRegister()
    {
        return $this->only(['user','password','passworda','captcha'])->append('user', 'unique:member');
    }
    //发布评论
    public function scenecomment()
    {
        return $this->only(['user','code','content'])->remove('user', 'unique');
    }

    public function scenepassword()
    {
        return $this->only(['passworda','password','newpassword'])->append('passworda', 'require');
    }



}